{% load get_page %}

{% extends 'beastly/base.html' %}

{% block page_title %}
<h2>Forums</h2>
<p>{{ total_topics }} topics and {{ total_posts }} posts</p>
{% endblock %}

{% block content %}
<table class="forums" border="0">
	<tr>
		<th colspan="2">Forum</th>
		<th>Last Post</th>
	</tr>
	{% for forum in forum_list %}
	<tr>
		<td class="activity">
			<img src="{{ media_url }}beastly/img/icons/quote-grey.png" alt="rec" />
		</td>
		<td class="cell2">
			<a href="/beastly/forums/{{ forum.id }}/">{{ forum.title }}</a>
			<p class="topics_posts">{{ forum.topic_set.count }} topics, {{ forum.post_count }} posts</p>
			<p class="description">{{ forum.description }}</p>
		</td>
		<td class="last_post">
			{% if forum.latest_post %}
			<p class="time_since">{{ forum.latest_post.added|timesince }} ago</p>
			<p>by <span class="author">{{ forum.latest_post.user.username }}</span> (<a href="/beastly/forums/{{ forum.id }}/topics/{{ forum.latest_post.topic_orig.id }}/?page={{ forum.latest_post.count|get_page }}#post-{{ forum.latest_post.count }}">view</a>)</p>
			{% else %}
			<p>never ago</p>
			{% endif %}
		</td>
	</tr>
	{% endfor %}
</table>
{% endblock %}
